//
//  SceneTableViewCell.m
//  HappyToday
//
//  Created by Ale (ziming) Lee on 16/8/11.
//  Copyright © 2016年 ziming_lee. All rights reserved.
//

#import "SceneTableViewCell.h"
#import "CommentTableViewCell.h"

@implementation SceneTableViewCell

- (void)awakeFromNib {

    [super awakeFromNib];


    self.userPicImg.layer.cornerRadius = 25.f;




}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setUserModel:(UserModel *)userModel{

    _userModel = userModel;
    self.userName.text = _userModel.userName;

    [self.userPicImg setImageWithURL:[NSURL URLWithString:_userModel.userPic]];

}
-(void)setStoryModel:(storyModel *)storyModel{

    _storyModel = storyModel;
    self.storyTime.text = _storyModel.time;
    self.storyComment.text = _storyModel.comment;
    self.storyProjectName.text = _storyModel.projectName;
    [self.storyContextImg setImageWithURL:[NSURL URLWithString:_storyModel.context]];
    [self.storyPicImg setImageWithURL:[NSURL URLWithString:_storyModel.pic]];


}
-(void)setPraiseModel:(praiseModel *)praiseModel{

    _praiseModel = praiseModel;
//    self.praiseInfo.text = praiseModel.userName;

}

-(void)setCommentView:(UIView *)commentView{
    _commentView = commentView;

    UITableView *commentTableView = [[UITableView alloc]initWithFrame:CGRectMake(0,0, KScreenW,21) style:UITableViewStylePlain];
    commentTableView.dataSource = self;
    commentTableView.delegate = self;
    commentTableView.scrollEnabled = NO;
    [_commentView addSubview:commentTableView];


}
#pragma ----mark---------commentTableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{

    return 2;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    if (section == 0) {
        return 1;
    }else{

    return 2;
    }
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath == 0) {
        CommentTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"comment_cell1"];
        if (!cell) {

            cell = [[[NSBundle mainBundle]loadNibNamed:@"CommentTableViewCell" owner:nil options:nil] firstObject];
        }
    }else{

        CommentTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"comment_cell2"];
        if (!cell) {

            cell = [[[NSBundle mainBundle]loadNibNamed:@"CommentTableViewCell" owner:nil options:nil] lastObject];
        }
        return cell;
    }


    return nil;

}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 30;

}
- (IBAction)AlertViewButton:(UIButton *)sender {
}
- (IBAction)praiseInfoButton:(UIButton *)sender {
}
- (IBAction)commentButton:(UIButton *)sender {
}

+(CGFloat)sceneTableViewHeight{


    return 0;
}

@end
